import request from '@/utils/request'

/**
 * 新增部门
 * @param {*} data
 * @returns
 */

export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

/**
 * 获取所有的部门
 * @returns
 */

export function getDepartments() {
  return request({
    url: '/company/department',
    method: 'get'
  })
}

/**
 * 修改部门
 * @returns
 */

export function updateDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}

/**
 * 删除指定部门
 * @returns
 */

export function delDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}

/**
 * 查询指定的部门
 * @returns
 */

export function chaDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}
